package com.sam.enumeration;

public enum Operation {

	PLUS, MINUS, TIMES, DIVIDE, EW;

	double apply(double x, double y) {

		switch (this) {
		case PLUS:
			return x + y;
		case MINUS:
			return x - y;
		case TIMES:
			return x * y;
		case DIVIDE:
			return x / y;
		default:
			throw new AssertionError("未定义枚举操作！");
		}

	}

	public static void main(String args[]) {

		int a = (int) Operation.EW.apply(1, 2);
		System.out.println(a);
	}

}
